* TODO: Document 'section' / 'subsection' stuff
*/
class HTMLForm {
- static $jsAdded = false;
# A mapping of 'type' inputs onto standard HTMLFormField subclasses
static $typeMappings = array(
/**
* Add the HTMLForm-specific JavaScript, if it hasn't been
* done already.
+ * @deprecated @since 1.18 load modules with ResourceLoader instead
*/
- static function addJS() {
- if ( self::$jsAdded ) return;
-
- global $wgOut;
-
- $wgOut->addModules( 'mediawiki.legacy.htmlform' );
- }
+ static function addJS() { }
/**
* Initialise a new Object for the field
throw new MWException( "You must call setTitle() on an HTMLForm" );
}
- // FIXME shouldn't this be closer to displayForm() ?
- self::addJS();
-
# Load data from the request.
$this->loadData();
}
'localBasePath' => "{$GLOBALS['IP']}/skins",
'dependencies' => 'mediawiki.legacy.wikibits',
),
- 'mediawiki.legacy.htmlform' => array(
- 'scripts' => 'common/htmlform.js',
- 'remoteBasePath' => $GLOBALS['wgStylePath'],
- 'localBasePath' => "{$GLOBALS['IP']}/skins",
- 'dependencies' => 'mediawiki.legacy.wikibits',
- ),
'mediawiki.legacy.IEFixes' => array(
'scripts' => 'common/IEFixes.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
'scripts' => 'common/prefs.js',
'remoteBasePath' => $GLOBALS['wgStylePath'],
'localBasePath' => "{$GLOBALS['IP']}/skins",
- 'dependencies' => array( 'mediawiki.legacy.wikibits', 'mediawiki.legacy.htmlform' ),
+ 'dependencies' => array( 'mediawiki.legacy.wikibits', 'mediawiki.htmlform' ),
),
'mediawiki.legacy.preview' => array(
'scripts' => 'common/preview.js',
+++ /dev/null
-// Find select-or-other fields.
-addOnloadHook( function() {
- var fields = getElementsByClassName( document, 'select', 'mw-htmlform-select-or-other' );
-
- for( var i = 0; i < fields.length; i++ ) {
- var select = fields[i];
-
- addHandler( select, 'change', htmlforms.selectOrOtherSelectChanged );
-
- // Use a fake 'e' to update it.
- htmlforms.selectOrOtherSelectChanged( { 'target': select } );
- }
-} );
-
-window.htmlforms = {
- 'selectOrOtherSelectChanged' : function( e ) {
- var select;
- if ( !e ) {
- e = window.event;
- }
- if ( e.target ) {
- select = e.target;
- } else if ( e.srcElement ) {
- select = e.srcElement;
- }
- if ( select.nodeType == 3 ) { // defeat Safari bug
- select = select.parentNode;
- }
-
- var id = select.id;
- var textbox = document.getElementById( id + '-other' );
-
- textbox.disabled = ( select.value != 'other' );
- }
-};
-